package com.zzj.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zzj.bean.TabSupplier;
import com.zzj.dao.TabSupplierMapper;
import com.zzj.service.TabSupplierService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * InnoDB free: 8192 kB 服务实现类
 * </p>
 *
 * @author 花
 * @since 2022-03-04
 */
@Service
public class TabSupplierServiceImpl extends ServiceImpl<TabSupplierMapper, TabSupplier> implements TabSupplierService {

    @Resource
    private TabSupplierMapper tabSupplierMapper;

    @Override
    public boolean updateSustatus(String suid, String sustatus) {
        if (sustatus.equals("0")){
            tabSupplierMapper.updateSustatus(suid,"1");
        }
        return true;
    }

    /**分页查询所有数据，根据状态排序
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public PageInfo<TabSupplier> findAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<TabSupplier> list = tabSupplierMapper.findAll();
        return new PageInfo<>(list);

    }
}
